import 'package:PollOnLine/utils/logger_utils.dart';
import 'package:flutter/cupertino.dart';

///
/// @Description: Row组件中间添加分割线
/// @Author: 下雨了
/// @CreateDate: 2024-01-09 16:03
/// @UpdateUser: 更新者
/// @UpdateDate:  2024-01-09 16:03
/// @UpdateRemark: 更新说明
/// @Version: 1.0
///

class SeparatorRow extends Row {
  final Widget Function(int index) separatorBuilder;

  SeparatorRow({
    super.key,
    super.mainAxisAlignment,
    super.mainAxisSize,
    super.crossAxisAlignment,
    super.textDirection,
    super.verticalDirection,
    super.textBaseline,
    super.children,
    required this.separatorBuilder,
  }) {
    if (children.isNotEmpty) {
      for (int i = 0; i < children.length; i++) {
        if (i.isOdd) {
          children.insert(i, separatorBuilder(i));
        }
      }
    }

    // if (children.length > 1) {
    //   List.generate(children.length - 1, (i) {
    //     children.insert(i * 2 + 1, separatorBuilder(i));
    //   });
    // }
  }
}
